Platform Explorer / Nuxeo Platform 5.8

Component org.nuxeo.ecm.rating.actions

Contributions

XML Source

<?xml version="1.0" encoding="UTF-8"?>
<component name="org.nuxeo.ecm.rating.actions">

  <extension target="org.nuxeo.ecm.platform.actions.ActionService"
    point="actions">

    <action id="documentLike" order="5" type="link"
      link="#{likeActions.like(currentUser, currentDocument)}"
      icon="/icons/like.png" label="command.like">
      <category>DOCUMENT_UPPER_ACTION</category>
      <filter-id>mutable_document</filter-id>
      <filter-id>not_folder</filter-id>
      <filter-id>userNotLiked</filter-id>
      <properties>
        <property name="ajaxSupport">true</property>
      </properties>
    </action>

    <action id="documentUnlike" order="5" type="link"
      link="#{likeActions.cancelLike(currentUser, currentDocument)}"
      icon="/icons/unlike.png" label="command.unlike">
      <category>DOCUMENT_UPPER_ACTION</category>
      <filter-id>mutable_document</filter-id>
      <filter-id>not_folder</filter-id>
      <filter-id>userLiked</filter-id>
      <properties>
        <property name="ajaxSupport">true</property>
      </properties>
    </action>

  </extension>

  <extension target="org.nuxeo.ecm.platform.actions.ActionService"
    point="filters">

    <filter id="userLiked">
      <rule grant="true">
        <condition>
          #{likeActions.hasUserLiked(currentUser, currentDocument)}
        </condition>
      </rule>
    </filter>

    <filter id="userNotLiked">
      <rule grant="false">
        <condition>
          #{likeActions.hasUserLiked(currentUser, currentDocument)}
        </condition>
      </rule>
    </filter>

  </extension>

</component>